<template>
  <basic-container>
    <h3>测试页</h3>
    <h4 v-text="msg"></h4>
    <avue-crud :data="data" :option="option"></avue-crud>
  </basic-container>
</template>

<script>
import { test } from "@/api/test";
export default {
  data() {
    return {
      data: [
        {
          name: "张三",
          sex: "男",
          date: "1994-02-23 00:00:00",
        },
        {
          name: "李四",
          sex: "女",
          date: "1994-02-23 00:00:00",
        },
        {
          name: "王五",
          sex: "女",
          date: "1994-02-23 00:00:00",
        },
        {
          name: "赵六",
          sex: "男",
          date: "1994-02-23 00:00:00",
        },
      ],
      option: {
        title: "表格的标题",
        page: false,
        align: "center",
        menuAlign: "center",
        column: [
          {
            label: "姓名",
            prop: "name",
          },
          {
            label: "性别",
            prop: "sex",
          },
          {
            label: "日期",
            prop: "date",
            type: "date",
            format: "yyyy-MM-dd hh:mm:ss",
            valueFormat: "yyyy-MM-dd hh:mm:ss",
          },
        ],
      },
      msg: "hello!",
    };
  },
  mounted() {
    this.init();
  },
  methods: {
    init() {
      test().then((res) => {
        // 根据返回值做一些事情
        // 控制台打印
        window.console.log(res.data);
        // 绑定到msg
        this.msg = res.data.success;
      });
    },
  },
};
</script>

<style>
</style>
